﻿Public Class Login
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
        If (HttpContext.Current.User.Identity.IsAuthenticated) Then
            Response.Write("Bienvenido : " + User.Identity.Name)
        End If
    End Sub

    Protected Sub bntInicioSesion_Click(sender As Object, e As EventArgs) Handles bntInicioSesion.Click
        If Autenticar(txtUserName.Text, txtPassword.Text) Then
            Session("Login") = User.Identity.Name
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
        Else
            Response.Write("Error usuario y/o password incorrectos")
        End If
    End Sub
End Class